import { Constant } from "../../Constant";
import { Main } from "../../Main";
import StateBase from "../StateBase";

export default class PrepareState extends StateBase {
    public begin(preState: number): void {
        super.begin(preState);
      //  console.log('PrepareState state--begin', this.getUserData());
        const main = this.getUserData() as Main;
        main.firstRoundRoles.forEach(e => e.setActive(true));
        main.roundOptions[0].active = true;
        main.frontBg.playAnimation(Constant.FrontBgAni.Appear, 0.2);
        main.lightAnimation.setColor([0, 0, 2]);
        main.roundTips[0].showStart(true);
        main.scheduleOnce(() => {
            main.firstRoundRoles?.forEach((note, index) => {
                note.startGlow(() => {
                    main.lightAnimation.showLight(index);
                }, this)
            })
        }, 0.5);

    }
    public end(nextState: number): void {
        super.end(nextState);
        //console.log('PrepareState state--end');
    }
}